/*
 * Copyright (c) 2019. ascend 版权所有禁止转载。
 */

package cn.edu.zua.demo16.service;

import cn.edu.zua.demo16.entity.TestUserEntity;
import cn.edu.zua.demo16.jpa.TestUserJpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 说明：
 *
 * @author ascend
 * 2019/1/29 13:52
 */
@Service
@CacheConfig(cacheNames = "user")
public class TestUserServiceImpl {
    private TestUserJpa userJpa;

    @Autowired
    public TestUserServiceImpl(TestUserJpa userJpa) {
        this.userJpa = userJpa;
    }

    @Cacheable(cacheNames = "list")
    public List<TestUserEntity> list() {
        return userJpa.findAll();
    }
}
